using System;

namespace UraniaLib
{
	/// <summary>
	/// Summary description for UraniaHorizon.
	/// </summary>
	public class UraniaHorizon
	{
		public UraniaHorizon()
		{

		}

		public static double fEarthRadius = 6371.0;
		
		public static double HorizonDistance(double pdHeight, double pdRadius)
		{
			if (pdRadius == 0)
			{
				pdRadius = UraniaHorizon.fEarthRadius;
			}
			return System.Math.Sqrt(pdRadius * 2.0) * System.Math.Sqrt(pdHeight / 1000.0);
		}
		
		public static double HorizonHeight(double pdDistance, double pdRadius)
		{
			if (pdRadius == 0)
			{
				pdRadius = UraniaHorizon.fEarthRadius;
			}
			return ((pdDistance / System.Math.Sqrt(pdRadius * 2.0)) *(pdDistance / 112.88)) * 1000.0;
		}
	}
}
